// key

const p1 = Symbol('李四')
const p2 = Symbol('李四')
const persons = {
  [p1]: { tel: 13900110022, address: '北京' },
  [p2]: { tel: 18622113355, address: '上海' }
}
console.log(persons[p1])

// 魔法字符串
const type = {
  triangle: Symbol(),
  circle: Symbol()
}
function getNumber(val) {
  let num = 0
  switch (val) {
    case type.triangle:
      num = 1
      break
    case type.circle:
      num = 2
      break
  }
  return num
}
console.log(getNumber(type.triangle)) // 1
